package com.ly.mpayment.persist.entity;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * DownRechargeFlow entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "down_order")
public class DownRechargeFlow implements java.io.Serializable {

	// Fields

	private String downorderuuid;
	private DownShopProduct downShopProduct;
	private ProvincialInformation flowInformation;
	private User userFlow;
	private String operators;
	private String downreqid;
	private String dowonphonenum;
	private int status;
	private Date createtime;
	//批次号
	private String statusremark;
	// private String downrespondid;
	private String province;
	private Date downendtime;
	private String remark;
	private BigDecimal rechargeamount;
	private int downrechargenum;
//	private String fastchargetype;
	private String downnotificationaddress;
	private int downendtimesec;
	/**
	 * 已重复提交次数
	 */
	private int downreqnum;
	private String busCode;
	private int callStatus;
	private BigDecimal discount;
	private int callNum;
	private BigDecimal discountAmount;
	private String cityName;
	private String operatorname;
	private String name;
	private String areaName;
	private String sourceIp;
	private String rechargeType;
	private String server;


	private Set<DownOrderRefund> downOrderRefunds = new HashSet<DownOrderRefund>(0);
	private Set<DownOrderLog> downOrderLogs = new HashSet<DownOrderLog>(0);
	private Set<UpOrder> upOrders = new HashSet<UpOrder>(0);
//	private List<OrderMatchDetail> orderMatchDetails;

	// Constructors

	/** default constructor */
	public DownRechargeFlow() {
	}

	/** full constructor */
	public DownRechargeFlow(DownShopProduct downShopProduct, ProvincialInformation provincialInformation, User user,
			String downreqid, String dowonphonenum, int status, Date createtime, String statusremark,
			String downrespondid, Date downendtime, String remark, BigDecimal rechargeamount, int downrechargenum,
			String fastchargetype, String downnotificationaddress, BigDecimal successamount, int downendtimesec,
			int downreqnum, Set<DownOrderRefund> downOrderRefunds, Set<DownOrderLog> downOrderLogs,
			Set<UpOrder> upOrders) {
		this.downShopProduct = downShopProduct;
		this.flowInformation = provincialInformation;
		this.userFlow = user;
		this.downreqid = downreqid;
		this.dowonphonenum = dowonphonenum;
		this.status = status;
		this.createtime = createtime;
		this.statusremark = statusremark;
		// this.downrespondid = downrespondid;
		this.downendtime = downendtime;
		this.remark = remark;
		this.rechargeamount = rechargeamount;
//		this.downrechargenum = downrechargenum;
//		this.fastchargetype = fastchargetype;
		this.downnotificationaddress = downnotificationaddress;
		this.downendtimesec = downendtimesec;
		this.downreqnum = downreqnum;
		this.downOrderRefunds = downOrderRefunds;
		this.downOrderLogs = downOrderLogs;
		this.upOrders = upOrders;
	}

	public DownRechargeFlow(String downorderuuid, DownShopProduct downShopProduct, ProvincialInformation flowInformation, User
			userFlow, String operators, String downreqid, String dowonphonenum, int status, Date createtime,
							String statusremark, String province, Date downendtime, String remark,
							BigDecimal rechargeamount, int downrechargenum, String downnotificationaddress,
							int downendtimesec, int downreqnum, String busCode, int callStatus, BigDecimal discount,
							int callNum, BigDecimal discountAmount, String cityName, Set<DownOrderRefund> downOrderRefunds,
							Set<DownOrderLog> downOrderLogs, Set<UpOrder> upOrders) {
		this.downorderuuid = downorderuuid;
		this.downShopProduct = downShopProduct;
		this.flowInformation = flowInformation;
		this.userFlow = userFlow;
		this.operators = operators;
		this.downreqid = downreqid;
		this.dowonphonenum = dowonphonenum;
		this.status = status;
		this.createtime = createtime;
		this.statusremark = statusremark;
		this.province = province;
		this.downendtime = downendtime;
		this.remark = remark;
		this.rechargeamount = rechargeamount;
		this.downrechargenum = downrechargenum;
		this.downnotificationaddress = downnotificationaddress;
		this.downendtimesec = downendtimesec;
		this.downreqnum = downreqnum;
		this.busCode = busCode;
		this.callStatus = callStatus;
		this.discount = discount;
		this.callNum = callNum;
		this.discountAmount = discountAmount;
		this.cityName = cityName;
		this.downOrderRefunds = downOrderRefunds;
		this.downOrderLogs = downOrderLogs;
		this.upOrders = upOrders;
	}

	// Property accessors
	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid")
	@Column(name = "downorderuuid", unique = true, nullable = false, length = 32)
	public String getDownorderuuid() {
		return this.downorderuuid;
	}

	public void setDownorderuuid(String downorderuuid) {
		this.downorderuuid = downorderuuid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "downprouuid")

	public DownShopProduct getDownShopProduct() {
		return this.downShopProduct;
	}

	public void setDownShopProduct(DownShopProduct downShopProduct) {
		this.downShopProduct = downShopProduct;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "provinceuuid")

	public ProvincialInformation getFlowInformation() {
		return flowInformation;
	}

	public void setFlowInformation(ProvincialInformation flowInformation) {
		this.flowInformation = flowInformation;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "useruuid")
	public User getUserFlow() {
		return userFlow;
	}

	public void setUserFlow(User userFlow) {
		this.userFlow = userFlow;
	}

	@Column(name = "operatoruid")
	public String getOperators() {
		return operators;
	}

	public void setOperators(String operators) {
		this.operators = operators;
	}

	@Column(name = "downreqid", length = 40)

	public String getDownreqid() {
		return this.downreqid;
	}

	public void setDownreqid(String downreqid) {
		this.downreqid = downreqid;
	}

	@Column(name = "dowonphonenum", length = 20)

	public String getDowonphonenum() {
		return this.dowonphonenum;
	}

	public void setDowonphonenum(String dowonphonenum) {
		this.dowonphonenum = dowonphonenum;
	}

	@Column(name = "status", length = 40)

	public int getStatus() {
		return this.status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	@Column(name = "createtime", length = 19)

	public Date getCreatetime() {
		return this.createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	@Column(name = "statusremark", length = 40)

	public String getStatusremark() {
		return this.statusremark;
	}

	public void setStatusremark(String statusremark) {
		this.statusremark = statusremark;
	}

	// @Column(name="downrespondid", length=40)
	//
	// public String getDownrespondid() {
	// return this.downrespondid;
	// }
	//
	// public void setDownrespondid(String downrespondid) {
	// this.downrespondid = downrespondid;
	// }

	@Column(name = "downendtime", length = 19)

	public Date getDownendtime() {
		return this.downendtime;
	}

	public void setDownendtime(Date downendtime) {
		this.downendtime = downendtime;
	}

	@Column(name = "remark", length = 1000)

	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "rechargeamount", precision = 28, scale = 5)

	public BigDecimal getRechargeamount() {
		return this.rechargeamount;
	}

	public void setRechargeamount(BigDecimal rechargeamount) {
		this.rechargeamount = rechargeamount;
	}

	@Column(name = "downrechargenum")

	public int getDownrechargenum() {
		return this.downrechargenum;
	}

	public void setDownrechargenum(int downrechargenum) {
		this.downrechargenum = downrechargenum;
	}

//	@Column(name = "fastchargetype", length = 40)
//
//	public String getFastchargetype() {
//		return this.fastchargetype;
//	}
//
//	public void setFastchargetype(String fastchargetype) {
//		this.fastchargetype = fastchargetype;
//	}

	@Column(name = "downnotificationaddress", length = 500)

	public String getDownnotificationaddress() {
		return this.downnotificationaddress;
	}

	public void setDownnotificationaddress(String downnotificationaddress) {
		this.downnotificationaddress = downnotificationaddress;
	}

	@Column(name = "city_name", length = 20)
	public String getCityName() {
		return cityName;
	}

	public void setCityName(String cityName) {
		this.cityName = cityName;
	}

	//	@Column(name = "recharge_sum", precision = 28, scale = 5)
//	public BigDecimal getRechargeSum() {
//		return rechargeSum;
//	}
//
//	public void setRechargeSum(BigDecimal rechargeSum) {
//		this.rechargeSum = rechargeSum;
//	}

	@Column(name = "downendtimesec")

	public int getDownendtimesec() {
		return this.downendtimesec;
	}

	public void setDownendtimesec(int downendtimesec) {
		this.downendtimesec = downendtimesec;
	}

	@Column(name = "downreqnum")

	public int getDownreqnum() {
		return this.downreqnum;
	}

	public void setDownreqnum(int downreqnum) {
		this.downreqnum = downreqnum;
	}


//	@Column(name = "downfailnum")
//	public int getDownfailnum() {
//		return downfailnum;
//	}
//
//	public void setDownfailnum(int downfailnum) {
//		this.downfailnum = downfailnum;
//	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "downRechargeFlow")

	public Set<DownOrderRefund> getDownOrderRefunds() {
		return this.downOrderRefunds;
	}

	public void setDownOrderRefunds(Set<DownOrderRefund> downOrderRefunds) {
		this.downOrderRefunds = downOrderRefunds;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "downRechargeFlow")

	public Set<DownOrderLog> getDownOrderLogs() {
		return this.downOrderLogs;
	}

	public void setDownOrderLogs(Set<DownOrderLog> downOrderLogs) {
		this.downOrderLogs = downOrderLogs;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "downRechargeFlow")

	public Set<UpOrder> getUpOrders() {
		return this.upOrders;
	}

	public void setUpOrders(Set<UpOrder> upOrders) {
		this.upOrders = upOrders;
	}

	@Column(name = "province")
	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	@Column(name = "buscode")
	public String getBusCode() {
		return busCode;
	}

	public void setBusCode(String busCode) {
		this.busCode = busCode;
	}

	@Column(name = "call_status")
	public int getCallStatus() {
		return callStatus;
	}

	public void setCallStatus(int callStatus) {
		this.callStatus = callStatus;
	}

//	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "downRechargeFlow")
//	public List<OrderMatchDetail> getOrderMatchDetails() {
//		return orderMatchDetails;
//	}
//
//	public void setOrderMatchDetails(List<OrderMatchDetail> orderMatchDetails) {
//		this.orderMatchDetails = orderMatchDetails;
//	}

	@Column(name = "discount")

	public BigDecimal getDiscount() {
		return this.discount;
	}

	public void setDiscount(BigDecimal discount) {
		this.discount = discount;
	}

	@Column(name = "call_num")
	public int getCallNum() {
		return callNum;
	}

	public void setCallNum(int callNum) {
		this.callNum = callNum;
	}

	@Column(name="discount_amount", precision=28, scale=5)
	public BigDecimal getDiscountAmount() {
		return discountAmount;
	}


	public void setDiscountAmount(BigDecimal discountAmount) {
		this.discountAmount = discountAmount;
	}

	@Column(name = "operatorname")
	public String getOperatorname() {
		return operatorname;
	}

	public void setOperatorname(String operatorname) {
		this.operatorname = operatorname;
	}

	@Column(name = "name")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "area_name")
	public String getAreaName() {
		return areaName;
	}

	public void setAreaName(String areaName) {
		this.areaName = areaName;
	}

	@Column(name = "source_ip")
	public String getSourceIp() {
		return sourceIp;
	}

	public void setSourceIp(String sourceIp) {
		this.sourceIp = sourceIp;
	}

	@Column(name = "recharge_type")
	public String getRechargeType() {
		return rechargeType;
	}

	public void setRechargeType(String rechargeType) {
		this.rechargeType = rechargeType;
	}

	@Column(name = "server")
	public String getServer() {
		return server;
	}

	public void setServer(String server) {
		this.server = server;
	}

	@Override
	public String toString() {
		return "DownRechargeFlow [downorderuuid=" + downorderuuid + ", downShopProduct=" + downShopProduct.getDownprouuid()
				+ ", flowInformation=" + flowInformation + ", userFlow=" + userFlow + ", operators=" + operators
				+ ", downreqid=" + downreqid + ", dowonphonenum=" + dowonphonenum + ", status=" + status
				+ ", createtime=" + createtime + ", statusremark=" + statusremark + ", province=" + province
				+ ", downendtime=" + downendtime + ", remark=" + remark + ", rechargeamount=" + rechargeamount
				+ ", downnotificationaddress=" + downnotificationaddress + ", downendtimesec=" + downendtimesec
				+ ", downreqnum=" + downreqnum + ", busCode=" + busCode + ", callStatus=" + callStatus + ", discount="
				+  "]";
	}



}
